//
//  MTTaskInviteInfo.swift
//  MT
//
//  Created by ooops on 2020/5/26.
//  Copyright © 2020 张强. All rights reserved.
//

import Foundation
import ObjectMapper

///// 聚会任务类型1招募中、2进行中、3已结束
///// 聚会任务沟通群 - 聚会任务状态
enum MTPartyGroupTaskStatusType: Int {
    /// 招募中
    case wating = 1
    /// 已经开始 - 进行中
    case started = 2
    /// 已经结束
    case ended = 3
}

/// 聚会任务沟通群 - 聚会任务人 - 角色类型
enum MTPartyGroupTaskUserType: Int {
    /// 发起人
    case ownner = 1
    /// 未签到
    case unsign = 2
    /// 已签到
    case sign = 3
    /// 已经发过红吧 - 仅当角色为发起人时候有效
    case sendPack = 4
}

class MTTaskStatusInfoModel: Mappable {
    
    /// 请求是否成功的code
    var code: Int?
    /// 请求返回的Message
    var message: String?
    /// 分页对象
    var page: PageModel?
    /// 时间戳
    var timestamp: TimeInterval?
    
    var result: MTTaskStatusInfoSubModel?
    /// 聚会任务群是否已解散 - 接口获取后自己赋值
    var isRevokePartyGroup: Bool = false
    
    required public init?(map: Map) {
        
    }
    
    func mapping(map: Map) {
        code    <- map["code"]
        message <- map["message"]
        page <- map["page"]
        timestamp <- map["timestamp"]
        result  <- map["result"]
    }
}

class MTTaskStatusInfoSubModel: Mappable {
    /// 任务结束时间
    var endTime: String?
    
    /// 聚会任务Id
    var id: Int?
    
    /// 聚会任务群id
    var pushId: Int?
    
    /// 聚会任务开始时间
    var startTime: String?
    
    /// 聚会任务状态
    var status: MTPartyGroupTaskStatusType?
    
    /// 当前角色类型
    var type: MTPartyGroupTaskUserType?
    
    var href: String?
    
    required public init?(map: Map) {
        
    }
    
    func mapping(map: Map) {
        endTime <- map["endTime"]
        id <- map["id"]
        pushId <- map["pushId"]
        startTime <- map["startTime"]
        status <- map["status"]
        type <- map["type"]
        href <- map["href"]
    }
}
